<?php
/**
 * Created by PhpStorm.
 * User: hxsd
 * Date: 2019/7/17
 * Time: 15:27
 */
namespace App\Http\Middleware;

use Closure;
use Illuminate\Support\Facades\Auth;

class webToken
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        /*
        $user = \Auth::guard('api')->user();
        $token = $user->token;
        */

        if (Auth::guard('api')->guest()) {
            return response()->json(['code' => 401,'msg' => '您还没有登录']);
        }

        return $next($request);
    }

}
